<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var findRelativeRanks = function(score) {
				let sorted = score.slice(0),
					result = [],
					map = new Map();
				sorted.sort((a, b) => b - a);
				for (let i = 0; i < sorted.length; i++) {
					switch (i) {
						case 0:
							map.set(sorted[i], "Gold Medal");
							break;
						case 1:
							map.set(sorted[i], "Silver Medal");
							break;
						case 2:
							map.set(sorted[i], "Bronze Medal");
							break;
						default:
							map.set(sorted[i], String(i + 1));
					}
				}
				for (let i = 0; i < score.length; i++) {
					result.push(map.get(score[i]));
				}
				return result;
			};
			console.log(findRelativeRanks([10,3,8,9,4]));
		</script>
	</body>
</html>
